//
//  HEOrgTextCell.m
//  HealthFamily
//
//  Created by 吴欧 on 2020/11/26.
//  Copyright © 2020 honglutec. All rights reserved.
//

#import "HEOrgTextCell.h"
#import "HEOldPelOrgModel.h"

@interface HEOrgTextCell ()

@property(nonatomic, strong) UILabel *titleLb;

@property (nonatomic, strong) UITextView *contentLb;
@end

@implementation HEOrgTextCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = KWhiteColor;
        
        [self initUI];
    }
    return self;
}

- (void)initUI {
    UIView *dotView = [UIView new];
    dotView.backgroundColor = KHexColor(@"FFA900");
    [self.contentView addSubview:dotView];

    [dotView hg_setAllCornerWithCornerRadius: 5];
    
    
    _titleLb = [UILabel new];
    _titleLb.font = DYBlodFont(18);
    _titleLb.text = @"-";
    _titleLb.textColor = CNavLightBlackColor; 
    [self.contentView addSubview:_titleLb];
    
    [dotView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(_titleLb);
        make.left.equalTo(self.contentView).mas_offset(15);
        make.width.mas_offset(10);
        make.height.mas_offset(10);
    }];
    
    [_titleLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).mas_offset(15);
        make.left.equalTo(dotView.mas_right).mas_offset(10);
        make.right.equalTo(self.contentView).mas_offset(-15); 
    }];
    
    [_titleLb setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical];
    
    
    // 描述
    _contentLb = [UITextView new];
    _contentLb.text = @"-";
    _contentLb.editable=NO;
    _contentLb.scrollEnabled = NO;
    _contentLb.textColor = CNavLightBlackColor;
    _contentLb.font = DYFont(15);
    _contentLb.backgroundColor = UIColor.clearColor;
    [self.contentView addSubview:_contentLb];
    
    [_contentLb mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_titleLb.mas_bottom).mas_offset(0);
        make.left.equalTo(self.contentView).mas_offset(15);
        make.right.equalTo(self.contentView).mas_offset(-15);
        make.bottom.equalTo(self.contentView).mas_offset(-10);
    }];
}

- (void)refreshContent:(GDFiterCellModel *)fiterModel formModel:(GDFormModel *)formModel indexPath:(NSIndexPath *)indexPath {
 
    _titleLb.text = fiterModel.leftTitle;
    _contentLb.attributedText = formModel.dataSource[indexPath.section];
}

 

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
